<%@page import="java.io.PrintWriter"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@page import="dao.NoteDao" import="java.util.*"
	import="model.NoteModel" import="util.JsonHelp"%>

<%
	request.setCharacterEncoding("utf-8");
	//response.setContentType("html/text");
	JsonHelp render = new JsonHelp();
		String data="";
		String json;
		int  p = Integer.valueOf(request.getParameter("p"));
		if(p<=0){
	p=1;
		}
		NoteDao dao = new NoteDao();
		ArrayList<NoteModel> list = dao.selectShare(p);
		if(list.size()>0){
		for(int i=0;i<list.size();i++){
			String s = list.get(i).getTitle();
			String title;
			if(s.length()>80){
				title = s.substring(0,80)+"...";
			}else{
				title = s;
			}

	data+="<dl class='paper a"+(new java.util.Random().nextInt(5)+1)+"'>";
	data+="<dt>";
	data+="<span class='title'>"+title+"</span>";
 	data+="<span class='num'>"+list.get(i).getId()+"</span></dt>";
	data+="<dd class='content' title='查看详细信息' href='detail.jsp?id="+list.get(i).getId()+"'>"+list.get(i).getContent()+"</dd>";
	data+="<dd class='bottom'>";
	data+="<span class='time'>"+list.get(i).getDate()+"</span> <a href='' class='close'></a>";
	data+="</dd></dl>";
	} 
		json="{\"status\":1,\"html\":\""+data+"\"}";
		}else{
		json="{\"status\":0}";
		}
	render.renderJson(response, json);
%>
